<?

session_start();

include_once("../../Misc.php");
include_once("../../classCol/UID.php");
include_once("../../classCol/classOracleDb.php");
include_once("../../helpers/Composer.php");
include_once("../../helpers/ComposerSourceDb.php");
include_once("../models/fetchers.php");

$CLFetchers = new CLFetchers;

$SourceDb   = new Composer;
$SourceDb   = $SourceDb->init("db");

$SourceDb->add("srcDbRate",           "MUT_CURRENCY_RATE");
$SourceDb->add("srcDbRateHandling",   "MST_CURRENCY_HANDLING");

$COracle = new oracleDb;
$COracle->init($_SESSION["ORCL"],
               $_SESSION["OPASS"],
               $_SESSION["SID"],
               _NO_COMMENT);



if($COracle->connect()){

  if($_POST["trDate"]){

    $date = date("d-m-Y",
                 strtotime($_POST["trDate"]));
  }else{

    $date = "";
  }

  $CLFetchers->fetchRate2($COracle,
                          $_SESSION["baseCurrency"],
                          $_POST["srcSymbol"],
                          $date,
                          $SourceDb,
                          $theRate);

  echo  $theRate;
}else{

  return "****";
}

?>